from django.contrib import admin
from store.models import TinyShop, Product, Order,GoodsLib,GoodsCategory

from imagekit.admin import AdminThumbnail
from .models import ProductImage

# Register your models here.
class TinyShopAdmin(admin.ModelAdmin):
    pass

admin.site.register(TinyShop, TinyShopAdmin)
admin.site.register(Product)
admin.site.register(Order)
admin.site.register(GoodsCategory)
admin.site.register(GoodsLib)


class ProductImageAdmin(admin.ModelAdmin):
    list_display = ('__str__', 'admin_thumbnail')
    admin_thumbnail = AdminThumbnail(image_field='image')

admin.site.register(ProductImage, ProductImageAdmin)




from django.contrib.flatpages.models import FlatPage
 
from django.contrib.flatpages.admin import FlatPageAdmin as OldFlatPageAdmin
from django.contrib.flatpages.admin import FlatpageForm as OldFlatpageForm
 
from django import forms
from ckeditor.widgets import CKEditorWidget
 
class FlatpageForm(OldFlatpageForm):
    #content = forms.CharField(widget=RedactorEditor())
    class Meta:
        model = FlatPage
        widgets = {
           'content': CKEditorWidget(),
        }
 
class FlatPageAdmin(OldFlatPageAdmin):
    form = FlatpageForm
 
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, FlatPageAdmin)